// eslint-disable-next-line no-shadow
export enum V_ecDatatype {
  Float32 = 0,
  Float64,
  Int8,
  Int16,
  Int32,
  Int64,
  UInt8,
  UInt16,
  UInt32,
  UInt64,
  DateTime,
  Date,
  Time,
  Bool,
  String,
  Bit
}

// eslint-disable-next-line no-shadow
export enum V_ecBoxType {
  NOTSET = 0,
  MITSUBISHI_PLC_Q,
  SIEMENS_PLC_S7_1500,
  SIEMENS_PLC_S7_200_SMART
}
// eslint-disable-next-line no-shadow
export enum V_reqStatus {
  NOTSTART = 0,
  RUNNING,
  FINISHED
}
export interface I_scadaReadResp {
  success: boolean;
  msg: string;
  data: {
    [key: string]: {
      dataType?: V_ecDatatype;
      controllerType?: V_ecBoxType;
      v: any;
      err?: string;
    };
  };
}

export interface I_scadaWriteResp {
  success: boolean;
  msg: string;
  data: null;
}

export interface I_scadaWriteCodeRes {
  ecDetCode: string;
  value: string;
}
export interface I_scadaWriteRes {
  writeList: I_scadaWriteCodeRes[];
}

export interface I_qryDataResp {
  success: boolean;
  msg: string;
  // data: Map<
  //   string,
  //   {
  //     d: Array<{ t: string; v: any }>;
  //     total: number;
  //   }
  // >;
  data: string;
}

export interface DataPoint {
  t: string; // ISO 8601 格式的时间戳
  v: number; // 值
  label: string; // 标签
}

export interface I_codeData {
  total: number; // 总条目数
  d: DataPoint[]; // 数据点数组
  recErrs: null; // 记录错误（这里固定为 null）
}

export interface I_qryDataReq {
  ecCodes: string[];
  beginTime: string;
  endTime: string;
  pageNo: number;
  pageSize: number;
  filter?: { 'metadata.label': any };
}

export default class scadaHandle {
  // 后续补充read,write,queryData,scadaGetEcBox,scadaSubscribe,scadaUnSubscribe,scadaEventNotify
}
